package org.btik.light.nbi.cmd;

import com.google.gson.annotations.SerializedName;
import org.btik.light.meta.base.Command;

import java.util.ArrayList;

import static org.btik.light.meta.base.CmdCode.*;

/**
 * @author lustre
 * @since 2022/11/26 21:52
 */
public class JsonCmd implements Command {

    @SerializedName(DEV_SN)
    private String target;

    private int cmdId = 0;
    @SerializedName(OP_CODE)
    private int opcode;
    @SerializedName(PRAMS)
    private ArrayList<?> params;

    public void setTarget(String target) {
        this.target = target;
    }

    public void setOpcode(int opcode) {
        this.opcode = opcode;
    }

    public void setParams(ArrayList<?> params) {
        this.params = params;
    }

    public void setCmdId(int cmdId) {
        this.cmdId = cmdId;
    }

    public int getOpcode() {
        return opcode;
    }

    @Override
    public String getTarget() {
        return target;
    }

    @Override
    public int opCode() {
        return getOpcode();
    }

    @Override
    public ArrayList<?> getParams() {
        return params;
    }

    @Override
    public int getCmdId() {
        return cmdId;
    }

    @Override
    public String toString() {
        return "JsonCmd{" +
                "target='" + target + '\'' +
                ", cmdId=" + cmdId +
                ", opcode=" + opcode +
                ", params=" + params +
                '}';
    }
}
